﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="KMrpt1.aspx.cs" EnableEventValidation="false"
    Inherits="KMrpt1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>每日业绩汇报明细表</title>
    <link href="css/global.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery/jquery-1.8.1.min.js" type="text/javascript"></script>
    <script src="My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="js/main.js" type="text/javascript"></script>
    <link href="css/msgsty.css" rel="stylesheet" type="text/css" />
    <script src="js/config.js" type="text/javascript"></script>
    <script src="js/Gvtools.js" type="text/javascript"></script>
    <script type="text/javascript">
        function funGrilViewScroll() {
            if (document.getElementById("gvTitle") == null) {
                var gdvList = document.getElementById("GridView1");
                var gdvHeader = gdvList.cloneNode(true);
                for (i = gdvHeader.rows.length - 1; i > 0; i--) {
                    gdvHeader.deleteRow(i);
                }
                document.getElementById("divTitle").appendChild(gdvHeader);

                gdvList.deleteRow(0);

                //gdvList.rows[0].style.display = 'none';
            }
        }
        $(document).ready(function () {
            SetGvFloat("GridView1");
            SetPageBakguand($(".bg"));
            $('#business').click(function () {
                lodshoplist($("#txtshopname").val());
                if ($('.shoplist').css('display') == "none") {
                    $('.shoplist').css('display', 'block');
                }
                else {
                    $('.shoplist').css('display', 'none');
                }
            });
            $('#Button1').click(function () {
                $("#loading-mask").show();
            });
            $('#Button4').click(function () {
                lodshoplist($("#txtshopname").val());
            });

            $('#chkclose').click(function () {
                $('.shoplist').hide();
            });
            $('#chkclear').click(function () {
                $('#js_shop input[type="checkbox"]').each(function () {
                    if ($(this).attr('checked') == 'checked') {
                        $(this).click();
                    }
                });
                $('#business').val('');
            });
            $('#chkall').click(function () {
                $('#business').val("");
                $('#js_shop input[type="checkbox"]').each(function () {
                    var val = $('#business').val();
                    var chkVal = $(this).val();
                    if ($(this).attr('checked') == undefined) {
                        $(this).click();
                    }
                    $('#business').val(val + chkVal + ';');
                });
            });

        })
        function lodshoplist(val) {
            //加载门店
            $("#js_shop").html("加载数据中...")
            $.post(url_path + "/index.aspx",
                    { aciton: 'lodshoplist', shopname: val },
                     function (data) {
                         var msg = $.trim(data);
                         var html = '<table id="chkblist" class="slOption"><tbody>';
                         if (msg == "NO_DATA") {
                             html = "<tr><td>没有数据！</td></tr>"
                         } else {
                             var orderObj = JSON.parse(msg);
                             for (var i = 0; i < orderObj.length; i++) {
                                 html += '<tr><td><input name = "chkSon" type="checkbox" value="' + orderObj[i].shopid + '">' +
                                 '<label>' + orderObj[i].shopname + '</label></td></tr>';
                             }
                         }
                         html += '</tbody></table>';
                         $("#js_shop").html(html);
                         $('#js_shop input[type="checkbox"]').each(function () {
                             $(this).click(function () {
                                 var val = $('#business').val();
                                 var chkVal = $(this).val();
                                 if ($(this).attr('checked') == 'checked') {
                                     $('#business').val(val + chkVal + ';');
                                 }
                                 else {
                                     var result = val.replace(chkVal + ';', '');
                                     $('#business').val(result);
                                 }
                             })
                         });
                     });
        }
    </script>
    <style>
        .shoplist
        {
            width: 350px;
            display: none;
            border: 1px solid #ccd6de;
            position: fixed;
            z-index: 999;
            background-color: White;
            padding: 5px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div class="rptTitle">
            <b>每日业绩汇报明细表</b>
        </div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div class="param_div">
            <div class="input-group">
                <span class="input-group-addon">日期：</span>
                <asp:TextBox ID="sdate" runat="server" class="form-control" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"></asp:TextBox>
            </div>
            <div class="input-group">
                <span class="input-group-addon">店铺：</span>
                <asp:TextBox ID="business" class="form-control" runat="server" placeholder="点选选择店铺"></asp:TextBox>
                <div class="shoplist" runat="server" id="shoplist">
                    <div style="color: Gray;">
                        <span>提示：不选择店铺查询全部数据</span></div>
                    <div style="text-align: right; color: Blue; font-size: smaller;">
                        <span><a id="chkall" href="#">全选</a></span> <span><a id="chkclear" href="#">清除</a></span>
                        <span><a id="chkclose" href="#">关闭</a></span></div>
                    <div>
                        模糊查找：<asp:TextBox ID="txtshopname" runat="server" placeholder="输入店铺名称"></asp:TextBox>
                        <input id="Button4" type="button" value="查找" />
                    </div>
                    <div id="js_shop" style="overflow: auto; height: 300px; border: 1px solid #ccd6de;">
                        <asp:CheckBoxList ID="chkblist" CssClass="slOption" runat="server">
                            <%--<asp:ListItem Value="0" Text="0"></asp:ListItem>--%>
                        </asp:CheckBoxList>
                    </div>
                </div>
            </div>
            <div class="input-group">
                <%-- <a href="#" class="btn btn-info btn-lg btn-animate-demo">查询</a>--%>
                <asp:Button ID="Button1" runat="server" Text="查询" class="btn btn-info btn-lg btn-animate-demo"
                    OnClick="Button1_Click" />
                <asp:Button ID="Button2" runat="server" Text="导出EXCEL" class="btn btn-info btn-lg btn-animate-demo"
                    OnClick="Button2_Click" />
            </div>
        </div>
        <div class="grid_div">
            <div class="mycss" id="divGvData" runat="server" style="position: relative; top: 0px;
                left: 0px; width: 100%;">
                <div class="bg div_center">
                </div>
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" BackColor="White"
                    BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black"
                    GridLines="Horizontal" Width="100%" AutoGenerateColumns="False" EmptyDataText="暂无数据"
                    ShowFooter="True" ShowHeaderWhenEmpty="True" PageSize="300" OnPageIndexChanging="GridView1_PageIndexChanging"
                    OnDataBound="GridView1_DataBound" OnRowDataBound="GridView1_RowDataBound" AllowSorting="True"
                    OnSorting="GridView1_Sorting">
                    <Columns>
                        <asp:BoundField HeaderText="排名" DataField="orderid" SortExpression="orderid">
                            <HeaderStyle Width="50px" />
                            <ItemStyle Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="性质">
                            <HeaderStyle Width="50px" />
                            <ItemStyle Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="店铺简称" DataField="shopname" SortExpression="shopname">
                            <HeaderStyle Width="150px" />
                            <ItemStyle Width="150px" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="当日业绩（元）" DataField="payamt" DataFormatString="{0:N0}">
                            <HeaderStyle Width="80px" />
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="上周同比" DataField="upayamt">
                            <HeaderStyle Width="80px" />
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="客单价连带率" DataField="kdjrate" SortExpression="kdjrate">
                            <HeaderStyle Width="80px" />
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="客单价（元）" DataField="kdj" SortExpression="kdj">
                            <HeaderStyle Width="80px" />
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="本月总业绩累计（万）" DataField="allpayamt">
                            <HeaderStyle Width="80px" />
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="本月指标店业绩累计" DataField="allpayamt_b">
                            <HeaderStyle Width="80px" />
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="目标销额（万）" DataField="targetmoney">
                            <HeaderStyle Width="80px" />
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="月完成进度" DataField="wcl">
                            <HeaderStyle Width="80px" />
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="时间比" DataField="mrate">
                            <HeaderStyle Width="80px" />
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                    </Columns>
                    <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
                    <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
                    <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#F7F7F7" />
                    <SortedAscendingHeaderStyle BackColor="#4B4B4B" />
                    <SortedDescendingCellStyle BackColor="#E5E5E5" />
                    <SortedDescendingHeaderStyle BackColor="#242121" />
                </asp:GridView>
            </div>
            <div class="zeng_msgbox_layer_wrap" id="q_Msgbox" style="top: 109px; display: none;
                z-index: 10000;">
                <span class="zeng_msgbox_layer" style="z-index: 10000;" id="mode_tips_v2"><span class="gtl_ico_clear">
                </span><span class="gtl_ico_loading"></span>正在加载中，请稍后...<span class="gtl_end"></span></span></div>
        </div>
        <div id='loading-mask'>
            <div id="loading">
                <div class="loading-indicator">
                    <img src="images/0504317.gif" width="48" height="48" style="margin-right: 8px;" />
                    <br />
                    <span id="loading-msg">数据加载中...</span>
                </div>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
